package cn.itcast.mq.email.listener;


import cn.itcast.util.JedisUtils;
import cn.itcast.util.SmsBirthdayUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import redis.clients.jedis.Jedis;

import java.util.Map;

public class MySmsBirthdayListener implements MessageListener {
    @Override
    public void onMessage(Message message) {
        byte[] body = message.getBody();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Map<String,String> map = objectMapper.readValue(body, Map.class);
            String phone = map.get("phone");
            System.out.println("生日手机号:"+phone);
            //SmsBirthdayUtil.sendSms(phone);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
